3.6 \(\int \csc ^2(x) (a \cos (x)+b \sin (x)) \, dx\)

Optimal. Leaf size=12 \[ -a \csc (x)-b \tanh ^{-1}(\cos (x)) \]

[Out]

-(b*ArcTanh[Cos[x]]) - a*Csc[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0333175, antiderivative size = 12, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.286, Rules used = {3089, 3770, 2606, 8} \[ -a \csc (x)-b \tanh ^{-1}(\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[Csc[x]^2*(a*Cos[x] + b*Sin[x]),x]

[Out]

-(b*ArcTanh[Cos[x]]) - a*Csc[x]

Rule 3089

Int[sin[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[sin[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 2606

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \csc ^2(x) (a \cos (x)+b \sin (x)) \, dx &=\int (b \csc (x)+a \cot (x) \csc (x)) \, dx\\ &=a \int \cot (x) \csc (x) \, dx+b \int \csc (x) \, dx\\ &=-b \tanh ^{-1}(\cos (x))-a \operatorname{Subst}(\int 1 \, dx,x,\csc (x))\\ &=-b \tanh ^{-1}(\cos (x))-a \csc (x)\\ \end{align*}

Mathematica [B]  time = 0.0067673, size = 25, normalized size = 2.08 \[ -a \csc (x)+b \log \left (\sin \left (\frac{x}{2}\right )\right )-b \log \left (\cos \left (\frac{x}{2}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[x]^2*(a*Cos[x] + b*Sin[x]),x]

[Out]

-(a*Csc[x]) - b*Log[Cos[x/2]] + b*Log[Sin[x/2]]

________________________________________________________________________________________

Maple [A]  time = 0.037, size = 19, normalized size = 1.6 \begin{align*} -{\frac{a}{\sin \left ( x \right ) }}+b\ln \left ( -\cot \left ( x \right ) +\csc \left ( x \right ) \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)^2*(a*cos(x)+b*sin(x)),x)

[Out]

-a/sin(x)+b*ln(-cot(x)+csc(x))

________________________________________________________________________________________

Maxima [A]  time = 1.10404, size = 32, normalized size = 2.67 \begin{align*} -\frac{1}{2} \, b{\left (\log \left (\cos \left (x\right ) + 1\right ) - \log \left (\cos \left (x\right ) - 1\right )\right )} - \frac{a}{\sin \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

-1/2*b*(log(cos(x) + 1) - log(cos(x) - 1)) - a/sin(x)

________________________________________________________________________________________

Fricas [B]  time = 0.490314, size = 116, normalized size = 9.67 \begin{align*} -\frac{b \log \left (\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) \sin \left (x\right ) - b \log \left (-\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) \sin \left (x\right ) + 2 \, a}{2 \, \sin \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

-1/2*(b*log(1/2*cos(x) + 1/2)*sin(x) - b*log(-1/2*cos(x) + 1/2)*sin(x) + 2*a)/sin(x)

________________________________________________________________________________________

Sympy [A]  time = 3.85581, size = 24, normalized size = 2. \begin{align*} - \frac{a}{\sin{\left (x \right )}} + \frac{b \log{\left (\cos{\left (x \right )} - 1 \right )}}{2} - \frac{b \log{\left (\cos{\left (x \right )} + 1 \right )}}{2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)**2*(a*cos(x)+b*sin(x)),x)

[Out]

-a/sin(x) + b*log(cos(x) - 1)/2 - b*log(cos(x) + 1)/2

________________________________________________________________________________________

Giac [B]  time = 1.14332, size = 45, normalized size = 3.75 \begin{align*} b \log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) \right |}\right ) - \frac{1}{2} \, a \tan \left (\frac{1}{2} \, x\right ) - \frac{2 \, b \tan \left (\frac{1}{2} \, x\right ) + a}{2 \, \tan \left (\frac{1}{2} \, x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

b*log(abs(tan(1/2*x))) - 1/2*a*tan(1/2*x) - 1/2*(2*b*tan(1/2*x) + a)/tan(1/2*x)